<template>
  <div class="music_list">
    <table>
      <thead>
        <tr>
          <th class="first"></th>
          <th class="second">标题</th>
          <th class="third">时长</th>
          <th class="fourth">歌手</th>
        </tr>
      </thead>
      <tbody>
        <tr class="the_first">
          <td><span class="num">1</span> <span class="redu">0</span></td>
          <td class="text">
            <img :src="MusicList[0].al.picUrl" alt="" width="50px" />
            <div>
              <span class="before">&nbsp;</span> {{ MusicList[0].name }}
              <span class="behind">&nbsp;</span>
            </div>
          </td>
          <td class="timer">04:22</td>
          <td class="name">{{ MusicList[0].ar[0].name }}</td>
        </tr>
        <tr class="the_first">
          <td><span class="num">2</span> <span class="redu">0</span></td>
          <td class="text">
            <img :src="MusicList[1].al.picUrl" alt="" width="50px" />
            <div>
              <span class="before">&nbsp;</span> {{ MusicList[1].name }}
              <span class="behind">&nbsp;</span>
            </div>
          </td>
          <td class="timer">04:22</td>
          <td class="name">{{ MusicList[1].ar[0].name }}</td>
        </tr>
        <tr class="the_first">
          <td><span class="num">3</span> <span class="redu">0</span></td>
          <td class="text">
            <img :src="MusicList[2].al.picUrl" alt="" width="50px" />
            <div>
              <span class="before">&nbsp;</span> {{ MusicList[2].name }}
              <span class="behind">&nbsp;</span>
            </div>
          </td>
          <td class="timer">04:22</td>
          <td class="name">{{ MusicList[2].ar[0].name }}</td>
        </tr>
        <tr
          class="normal"
          v-for="(item, index) in MusicList"
          :key="item.id"
          v-show="index > 3"
        >
          <td>
            <span class="num">{{ index }}</span> <span class="redu">0</span>
          </td>
          <td class="text">
            <div>
              <span class="before">&nbsp;</span> {{ item.name }}
              <span class="behind">&nbsp;</span>
            </div>
          </td>
          <td class="timer">04:22</td>
          <td class="name">{{ item.ar[0].name }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
export default {
  props: ["MusicList"],
  data() {
    return {


    }
  }
}
</script>
 
<style lang = "less" scoped>
@import "../assets/base.less";
table {
  border-top: 2px solid #c20c0c;
  border-left: 2px solid #ccc;
  border-right: 2px solid #ccc;
  border-bottom: 1px solid #ccc;
  border-collapse: collapse;
  border-spacing: 0;
  text-indent: initial;
}
thead {
  background: url(../assets/table.png) 0 9999px;
  background-position: 0 -1px;
}
th {
  display: table-cell;
  height: 38px;
  background-color: #f7f7f7;
  background-position: 0 0;
  background-repeat: repeat-x;
  vertical-align: top;
  text-align: left;
  font-weight: normal;
  color: #666;
  background: url(../assets/table.png) no-repeat 0 9999px;

  &.first {
    width: 77px;
    background-position: -1px -56px;
    height: 18px;
    line-height: 18px;
    padding: 8px 10px;
    box-sizing: border-box;
  }
  &.second {
    width: 326px;
    background-position: 0 -56px;
    height: 18px;
    line-height: 18px;
    padding: 8px 10px;
    box-sizing: border-box;
  }
  &.third {
    width: 91px;
    background-position: 0 -56px;
    height: 18px;
    line-height: 18px;
    padding: 8px 10px;
    box-sizing: border-box;
  }
  &.fourth {
    width: 174px;
    background-position: 0 -56px;
    height: 18px;
    line-height: 18px;
    padding: 8px 10px;
    box-sizing: border-box;
  }
}
tbody tr:nth-of-type(odd) {
  background-color: #f7f7f7;
}
.text {
  img {
    float: left;
    margin: 10px;
  }
  div {
    float: left;
    margin-top: 30px;
    color: #333;
    font-size: 12px;
  }
}
.timer {
  color: #666;
  padding-left: 10px;
}
.name {
  color: #333;
  padding-left: 10px;
  cursor: pointer;
  &:hover {
    text-decoration: underline;
  }
}
.before {
  background: url(../assets/table.png) no-repeat 0 9999px;
  display: inline-block;
  width: 17px;
  height: 17px;
  cursor: pointer;
  background-position: 0 -103px;
}
.behind {
  background: url(../assets/table.png) no-repeat 0 9999px;
  display: inline-block;
  width: 23px;
  height: 17px;
  cursor: pointer;
  background-position: 0 -151px;
}
.num {
  float: left;
  width: 25px;
  margin-left: 0;
  text-align: center;
  color: #999999;
}
.redu {
  float: right;
  width: 32px;
  margin-right: 0;
  text-align: center;
  background: url(../assets/icon.png) no-repeat 0 9999px;
  background-position: -74px -268px;
  color: #999999;
}
.normal {
  .text {
    div {
      margin: 10px;
    }
  }
}
</style>